<html>
<head><meta charset="utf-8"><title>naive_bytecount suggesting extra dependency · clippy · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/index.html">clippy</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/naive_bytecount.20suggesting.20extra.20dependency.html">naive_bytecount suggesting extra dependency</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="228219672"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/naive_bytecount%20suggesting%20extra%20dependency/near/228219672" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dirkjan Ochtman <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/naive_bytecount.20suggesting.20extra.20dependency.html#228219672">(Mar 01 2021 at 12:13)</a>:</h4>
<p>I was surprised today when I noticed that the <code>naive_bytecode</code> lint (which appears to be enabled by default) suggests pulling in the <code>bytecount</code> crate off of <a href="http://crates.io">crates.io</a>. In my case, this is actually a false positive since my use case is only for short strings. Do we have many lints suggesting the use of other crates?</p>



<a name="228231623"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/naive_bytecount%20suggesting%20extra%20dependency/near/228231623" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/naive_bytecount.20suggesting.20extra.20dependency.html#228231623">(Mar 01 2021 at 13:46)</a>:</h4>
<p>We're usually really careful to not suggest any external crates. I also can't remember any lint added in the last 1-2 years suggesting an external crate.  I think this suggestion is ok. If you don't want to add this dep to your crate, I suggest to just allow this lint on crate level (as always).</p>



<a name="228245233"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/naive_bytecount%20suggesting%20extra%20dependency/near/228245233" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dirkjan Ochtman <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/naive_bytecount.20suggesting.20extra.20dependency.html#228245233">(Mar 01 2021 at 15:03)</a>:</h4>
<p>If we're "usually really careful to not suggest any extetrnal crates", why do you think "this suggestion is ok"?</p>



<a name="228245272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/naive_bytecount%20suggesting%20extra%20dependency/near/228245272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dirkjan Ochtman <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/naive_bytecount.20suggesting.20extra.20dependency.html#228245272">(Mar 01 2021 at 15:03)</a>:</h4>
<p>just because the lint is old?</p>



<a name="228245434"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/naive_bytecount%20suggesting%20extra%20dependency/near/228245434" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dirkjan Ochtman <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/naive_bytecount.20suggesting.20extra.20dependency.html#228245434">(Mar 01 2021 at 15:04)</a>:</h4>
<p>it sounds a bit like favoring the status quo just because it is the status quo -- if standards have developed, shouldn't it be okay to start applying them retroactively, too?</p>



<a name="228246464"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/naive_bytecount%20suggesting%20extra%20dependency/near/228246464" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/naive_bytecount.20suggesting.20extra.20dependency.html#228246464">(Mar 01 2021 at 15:10)</a>:</h4>
<p><span class="user-mention silent" data-user-id="226095">Dirkjan Ochtman</span> <a href="#narrow/stream/257328-clippy/topic/naive_bytecount.20suggesting.20extra.20dependency/near/228245272">said</a>:</p>
<blockquote>
<p>just because the lint is old?</p>
</blockquote>
<p>Thinking about it, yeah that's pretty much my only reason. And I see that it isn't a good reason. </p>
<p>A big reason why we don't usually do this, is to not favor one crate over another. Or even worse, get in trouble when a crate isn't maintained anymore and we keep suggesting it. </p>
<p>I don't think we can "fix" the lint and suggest anything better. So I would suggest to move it to pedantic And add a note to just not enable this lint, if adding this dependency isn't an option.</p>



<a name="228409743"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/naive_bytecount%20suggesting%20extra%20dependency/near/228409743" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dirkjan Ochtman <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/naive_bytecount.20suggesting.20extra.20dependency.html#228409743">(Mar 02 2021 at 13:35)</a>:</h4>
<p>Thanks for being open to my argument! I've submitted a PR: <a href="https://github.com/rust-lang/rust-clippy/pull/6825">https://github.com/rust-lang/rust-clippy/pull/6825</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>